<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>元素内容操作</title>
  </head>
  <body>
    <div id="box">
      The first paragraph...
      <p>
        The second  paragraph...
        <a href="http://www.example.com">third</a>
      </p>
    </div>
    <script>
      var box = document.getElementById('box');
      console.log(box.innerHTML);
      console.log(box.innerText);
      console.log(box.textContent);
    </script>
  </body>
</html>